package org.rm.entidades.exp;

import java.io.Serializable;
import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;
import org.rm.entidades.Partida;

@Entity
@NamedQueries( { @NamedQuery(name = "ExperienciaParcial.findByPartida", query = "SELECT e FROM ExperienciaParcial e WHERE e.partida = :partida") })
public class ExperienciaParcial implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -2155450778268381131L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY )
    @Basic(optional = false)
    private Integer id;

    @OneToOne
    private Partida partida;

    @Basic
    private int experiencia;

    public ExperienciaParcial() {
    }

    public ExperienciaParcial(int experiencia, Partida partida) {
        super();
        this.experiencia = experiencia;
        this.partida = partida;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Partida getPartida() {
        return partida;
    }

    public void setPartida(Partida partida) {
        this.partida = partida;
    }

    public int getExperiencia() {
        return experiencia;
    }

    public void setExperiencia(int experiencia) {
        this.experiencia = experiencia;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ExperienciaParcial)) {
            return false;
        }
        ExperienciaParcial other = (ExperienciaParcial) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }
}
